using EnvDTE;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.WowAddonStudio.Lua.LanguageService.CodeDom;
using Microsoft.WowAddonStudio.Lua.LanguageService.CodeDom.Providers;
using Microsoft.WowAddonStudio.Lua.LanguageService.Tests.WowCommonTestLibrary.Mocks;
using Microsoft.WowAddonStudio.Project;
using Microsoft.WowAddonStudio.Project.Automation;
using NUnit.Framework;

namespace WowProjectPackage.Tests
{
	[TestFixture]
	public sealed class OAWowFileItemTest : WowFileNodeTest
	{
		#region SetUp

		/// <summary>
		/// Sets up.
		/// </summary>
		[SetUp]
		public override void SetUp()
		{
			base.SetUp();
		}

		#endregion

		#region TearDown

		/// <summary>
		/// Tears down.
		/// </summary>
		[TearDown]
		public override void TearDown()
		{
			base.TearDown();
		}

		#endregion

		#region Tests

		/// <summary>
		/// Test_s the file code model.
		/// </summary>
		[Test(Description = "")]
		public void Test_FileCodeModel()
		{
			SetProjectNodeProperties(projectNode);
			WowFileNode luaFileNode = CreateLuaWowFileNode();
			var project = (MockOAProject) locator.GetService<Project>();
			project.SetDTE(locator.GetService<DTE>());

			var fileItem = new OAWowFileItem(project, luaFileNode);

			var fileCodeModel = fileItem.FileCodeModel;

			Assert.IsNotNull(fileCodeModel);
			Assert.IsInstanceOfType(typeof (LuaFileCodeModel), fileCodeModel);
		}

		/// <summary>
		/// Creates the lua wow file node.
		/// </summary>
		/// <returns></returns>
		protected override WowFileNode CreateLuaWowFileNode()
		{
			var node = base.CreateLuaWowFileNode();
			var provider = new VSMDLuaCodeDomProvider(locator);
			node.OleServiceProvider.AddService(typeof (SVSMDCodeDomProvider), provider, true);
			return node;
		}

		#endregion

	}
}